package tt.love.hw.jdo;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.IdGeneratorStrategy;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Application {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private String item;

	@Persistent
	private String remark;

	@Persistent
	private Date appDate;

	@Persistent
	private String requestUserId;
	

	@Persistent
	private String status;
	
	@Persistent
	private String newCommentBy;
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getItem() {
		return item;
	}

	public void setItem(String item) {
		this.item = item;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Date getAppDate() {
		return appDate;
	}

	public void setAppDate(Date appDate) {
		this.appDate = appDate;
	}

	public String getRequestUserId() {
		return requestUserId;
	}

	public void setRequestUserId(String requestUserId) {
		this.requestUserId = requestUserId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	
	

	
	public String getNewCommentBy() {
		return newCommentBy;
	}

	public void setNewCommentBy(String newCommentBy) {
		this.newCommentBy = newCommentBy;
	}
	
	

	public String getAppDateAsStr() {
		if (appDate != null) {
			Calendar calendar=Calendar.getInstance(); 
			calendar.setTime(appDate);
			calendar.add(Calendar.HOUR, 8);
			SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			return time.format(calendar.getTime());
		}
		return null;

	}

}
